package com.pan.listen.impl;

import com.pan.exe.Executive;
import com.pan.exe.driver.ExecutiveDriver;
import com.pan.listen.AbstractEventListener;

import java.util.*;
import java.util.concurrent.atomic.AtomicInteger;

public class CommonEventListenerImpl extends AbstractEventListener {


    /**
     * 算了算了，就直接单key触发事件吧
     */
//    {
//
//        String initKeyStr = "Esc,F1,F2,F3,F4,F5,F6,F7,F8,F9,F10,F11,F12,Pause,Print Screen,Insert,Delete,后引号,1,2,3,4,5,6,7,8,9,0,减号,等号,Backspace,Home,Tab,Q,W,E,R,T,Y,U,I,O,P,左方括号,右方括号,反斜杠,Page Up,Caps Lock,A,S,D,F,G,H,J,K,L,分号,引号,Enter,Page Down,Shift,Z,X,C,V,B,N,M,逗号,句点,斜杠,向上箭头,End,Ctrl,Meta,Alt,空格,上下文菜单,向左箭头,向下箭头,向右箭头";
//        String[] keys = initKeyStr.split(",");
//    }

    @Override
    public void keyPressed(String key) {
        if (getExecutiveHashMap().containsKey(key)) {
            Executive executive = getExecutiveHashMap().get(key);
            getExecutiveDriver().run(executive);
        }
    }
    @Override
    public void keyReleased(String key) {

    }

}
